/**
 * Copyright (C), 2021, 因特驰
 * FileName: AdminServiceImpl
 * Author:   李晋武
 * Date:     2021/7/14 1:01
 * Description:
 * History:
 * 李晋武          <time>          <version>          <desc>
 * 作者姓名           修改时间           版本号              描述
 */
package com.esc.service.impl;

import com.esc.mapper.AdminMapper;
import com.esc.model.Admin;
import com.esc.service.AdminService;
import com.esc.util.PageResult;
import com.esc.util.PageUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
 * 〈一句话功能简述〉<br> 
 * 〈〉
 *
 * @author Yun
 * @create 2021/7/14
 * @since 1.0.0
 */
@Service
public class AdminServiceImpl implements AdminService {

    @Autowired
    private AdminMapper adminMapper;

    @Override
    public PageResult queryAdminList(PageUtil<Admin> pageUtil,Integer queryId) {
        PageResult page = new PageResult();
        int total = adminMapper.queryCount(queryId);
        page.setTotal(total);
        List<Admin> list;
        list = adminMapper.queryAdminList(pageUtil.getStartIndex(),pageUtil.getRows(),queryId);
        page.setRows(list);
        return page;
    }

    @Override
    public Admin queryAdminById(Integer adminid) {
        return adminMapper.queryAdminById(adminid);
    }

    @Override
    public Admin queryAdminByName(String adminname) {
        return adminMapper.queryAdminByName(adminname);
    }

    @Override
    public void addAdmin(Admin admin) {
        adminMapper.addAdmin(admin);
    }
}